#include <iostream>
#include <cstring>
class String
{
	public:
		String(const char* str="")
			:_size(strlen(str))
		{
			_data=new char[_size+1];
			_capacity=_size;
			strcpy(_data,str);
		}
		
		String(const String* str)
		{
			_data=new char[strlen(str->_data)+1];
			strcpy(_data,str->_data);
			_size=str->_size;
			_capacity=str->_capacity;
		}
		String& operator=(const String* str)
		{
			delete _data;
			
			_data=new char[strlen(str->_data)+1];
			strcpy(_data,str->_data);
			_size=str->_size;
			_capacity=str->_capacity;	
			return *this;	
		}	
		~String()
		{
			if(_data)
			{
				delete _data;
				_data=nullptr;
				_size=_capacity=0;
			}
		}
	private:
		char *_data;
		int _size;
		int _capacity;
};
